home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 199 / 199.d81 / hk3 bridge (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  24KB  |  698 lines

  1. 1 rem    ***** hk bridge *****
  2. 5 dv=peek(186):ifdv<8thendv=8
  3. 40 sys57812"f.bridge",dv,0:poke780,0:poke781,0:poke782,8:sys65493
  4. 60 clr:dv=peek(186):ifdv<8thendv=8
  5. 100 rem    ***** set variables *****
  6. 105 ad=49152:ag=4096:s=54272:poke53272,19:printchr$(14):printchr$(8)
  7. 110 a$="":at=0:b$="":bh$="":bd=0:bk=0:bl=0:c$="":cd%=0
  8. 115 ch=0:cs=0:ct=0:d=0:df$="":dl$="":dr=0:ds=0
  9. 120 f%=0:fl%=0:ft%=1000:gt=0:gw=0:k=0
  10. 130 ms$="":nm$="":pc%=0
  11. 135 q=0:q$=chr$(34):qf=0:rn%=0
  12. 140 sn%=0:p%=0:sz=0:tv%=0
  13. 145 v=0:w$="":x=0:y=0:z=0:zs=0:x$=""
  14. 150 dima$(24),gl$(99),l1%(48),l2%(48),md$(2,20),sd$(8),sp$(5),zl(5),pv$(3)
  15. 155 dimst%(48),ub%(48),fl$(9),vt%(3,4),fm%(3),ra$(3),wn$(2),we%(2),sl%(3)
  16. 156 dimev%(0),gl%(0),se%(0),sd%(0),sp%(0),rt%(0),lo%(0),gc%(0),ds%(0),fu%(0)
  17. 157 dimel%(0),fc%(0),ts%(0),ra%(0)
  18. 160 dl%(1)=1:dl%(2)=12:dl%(3)=24:dl$(1)="[211][197][195][212][207][210] =":dl$(2)=":[199][210][201][196] = "
  19. 165 dl$(3)=":%[198][213][197][204] =":hd$(1)="[204]iverpool":hd$(2)="[211]outhampton":
  20. 170 hd$(3)="[199]ibralter":hd$(4)="[201]celand":hd$(5)="[200]alifax"
  21. 175 sa%(1)=-1:sa%(2)=1:sa%(3)=-9:sa%(4)=9:sa%(5)=-10:sa%(6)=10:sa%(7)=-11
  22. 180 sa%(8)=11:fl$(1)=".af":fl$(2)=".ad":fl$(3)=".co":fl$(4)=".ca":fl$(5)=".cr"
  23. 185 fl$(6)=".lt":fl$(7)=".po":fl$(8)=".os":fl$(9)=".ld":kf$="[136][140][133][135][134]^_[138][139][137]*"
  24. 190 sd$(1)="[206]orth":sd$(2)="[206]-[197]":sd$(3)="[211]-[197]":sd$(4)="[211]outh":sd$(5)="[197]ast"
  25. 195 sd$(6)="[206]-[215]":sd$(7)="[211]-[215]":sd$(8)="[215]est"
  26. 196 sp$(1)="5 [203]nots":sp$(2)="10 [203]nots":sp$(3)="15 [203]nots":sp$(4)="20 [203]nots"
  27. 200 sd$(0)="[211]top":sp$(0)="zero":ra$(1)=".ec":ra$(2)=".pa":ra$(3)=".er"
  28. 205 vt%(1,4)=120:vt%(1,3)=180:vt%(1,2)=240:vt%(1,1)=300
  29. 210 vt%(2,4)=180:vt%(2,3)=240:vt%(2,2)=300:vt%(2,1)=360
  30. 215 vt%(3,4)=240:vt%(3,3)=300:vt%(3,2)=360:vt%(3,1)=420:fm%(1)=-10:fm%(2)=-20
  31. 220 wn$(1)="[196]epth [195]harges":wn$(2)="[200]edgehog [204]oads"
  32. 225 sl%(0)=0:sl%(1)=40:sl%(2)=30:sl%(3)=15
  33. 230 pv$(0)="":pv$(1)="3124^_":pv$(2)="3421^_":pv$(3)="1243^_"
  34. 800 rem    ***** startup *****
  35. 805 print"[147]":ms$="[207]rganizing [206]avigation [205]aps.[144]":v=10:gosub5210
  36. 810 df$="game":dr=dv:gosub5115:ifpr<>3then5515
  37. 815 open3,dv,3,"l:"+df$:input#3,nm$,x$,a$:close3:ra%(0)=val(a$)
  38. 816 ifval(x$)>0then5520
  39. 817 gosub5740
  40. 820 gosub7705:ifqf<>1thengoto5515
  41. 825 df$="navigation data":dr=dv:gosub5115:ifpr<>3then5505
  42. 830 open3,dv,3,"l:"+df$+",p,r"
  43. 835 forx=0to1:fory=0to20:input#3,md$(x,y):next:next
  44. 840 forx=0to99:input#3,gl$(x):next:close3
  45. 1000 rem    ***** bridge *****
  46. 1005 print"[147]":bd=1:bk=1:ch=0:gosub5005
  47. 1010 zs=2:gosub6105:ms$=md$(0,0):gosub5208
  48. 1015 h=8:forv=3to17:ms$=md$(0,v-2):gosub5070:next
  49. 1020 h=3:v=6:ms$="[193]<-":gosub5070:h=22:v=2:ms$="[216] = [194]":gosub5070
  50. 1021 h=32:v=6:ms$="->[195]":gosub5070:v=10:ms$="->[196]":gosub5070
  51. 1022 v=16:ms$="->[197]":gosub5070
  52. 1023 h=1:v=19:ms$="[193] = [200]alifax.   [194] = [201]celand.":gosub5070
  53. 1024 v=20:ms$="[195] = [204]iverpool. [196] = [211]outhampton.":gosub5070
  54. 1025 v=21:ms$="[197] = [199]ibralter.":gosub5070
  55. 1030 gosub5225:ss=5:ss$="s":gosub5405
  56. 1032 gosub6955
  57. 1035 iflo%(0)<>0thenwe%(1)=100:we%(2)=100:fc%(0)=0:fu%(0)=100:rt%(0)=rt%(0)+1
  58. 1036 forx=1to7:onxgosub1405,1406,1410,1415,1420,1425,1430:next
  59. 1040 iflo%(0)=0thengosub1445:gosub1375:goto1060
  60. 1045 ms$="[217]ou are in "+hd$(lo%(0))+" [200]arbour.":gosub5208
  61. 1050 ms$="[193]ny key exits harbour.":cs=4:q=0:gosub5300:sp%(0)=1:gosub1185
  62. 1055 lo%(0)=0:forx=0to5:gosub1505:next:gosub1445:gosub1375
  63. 1060 gosub1805:gosub5034:ms$="[195]hange [195]ourse/[211]peed? (c/s)":zs=3
  64. 1100 ch$="cs":gosub6505:onqfgoto1105,1175,1100,1705,1100,3205,1170,1140,1035
  65. 1105 iff%=2then1125
  66. 1110 gosub5034:ms$="[195][207][213][210][211][197]: 1 = [206]orth, 2 = [206]ortheast,":gosub5209
  67. 1111 ms$="3 = [211]outheast, 4 = [211]outh, 5 = [197]ast,":gosub5206
  68. 1115 ms$="6 = [206]orthwest, 7 = [211]outhwest, 8 = [215]est.":gosub5205
  69. 1120 ch$="12345678":gosub6510:sd%(0)=f%:gosub1415:gosub5034:goto1060
  70. 1125 gosub5034:ms$="[211][208][197][197][196](knots): [193] = 5, [194] = 10,":gosub5206
  71. 1130 ms$="[195] = 15, [196] = 20.":gosub5205
  72. 1135 ch$="abcd":gosub6510:sp%(0)=f%:ifds%(0)<>0andsp%(0)>1thensp%(0)=sp%(0)-1
  73. 1137 gosub1420:gosub5034:goto1060
  74. 1140 gosub5034:mn%=sp%(0):fr=0
  75. 1145 gosub1390:ifqf=4thena%=0:goto1705
  76. 1146 gosub1505:onsd%(0)gosub3005,3105,3135,3035,3065,3575,3595,3155
  77. 1150 gosub3525:a=qf/2:onagoto1205,1705,3205,1035,1060
  78. 1155 gosub1450:mn%=mn%-1:gosub1235:ifmn%<1then1060
  79. 1160 goto1145
  80. 1170 gosub5034:gosub5380:goto5515
  81. 1175 gosub5034:gosub5380:goto5505
  82. 1185 onlo%(0)goto1186,1187,1188,1189,1190
  83. 1186 se%(0)=43:gl%(0)=19:sd%(0)=8:gosub1415:goto1420
  84. 1187 se%(0)=45:gl%(0)=49:sd%(0)=8:gosub1415:goto1420
  85. 1188 se%(0)=48:gl%(0)=89:sd%(0)=8:gosub1415:goto1420
  86. 1189 se%(0)=28:gl%(0)=5:sd%(0)=4:gosub1415:goto1420
  87. 1190 se%(0)=1:gl%(0)=40:sd%(0)=5:gosub1415:goto1420
  88. 1200 rem    ***** lost convoy *****
  89. 1205 lv%=ev%(0)/2:ev%(0)=ev%(0)-lv%:gosub5034
  90. 1210 ms$="[217]ou loose "+str$(lv%)+" ships due to bad":gosub5206
  91. 1215 ms$="weather and faulty navigation.":gosub5205
  92. 1220 ms$="[195]ommand stops to regroup. [193]ny key.":cs=4:q=0:v=24:gosub5305
  93. 1225 gosub5034:sd%(0)=0:sp%(0)=0:goto1035
  94. 1230 rem    ***** sailing problems *****
  95. 1235 e=1:ifst%(se%(0))=1andub%(se%(0))=1thene=3:b%=l1%(se%(0)):d%=l2%(se%(0)):goto1265
  96. 1240 ifst%(se%(0))=1thenb%=l1%(se%(0)):goto1265
  97. 1245 ifub%(se%(0))=1thend%=l2%(se%(0)):goto1270
  98. 1250 return
  99. 1260 rem    ***** problem filter/action *****
  100. 1265 c%=0:a%=b%:d=1:a=0:gosub1290:ifa=1then1275
  101. 1270 c%=0:a%=d%:d=2:a=0:gosub1290:ifa=1then1275
  102. 1272 gosub5043:return
  103. 1275 gosub1305
  104. 1276 gosub6020:rn%=rnd(0)*4+1:ifrn%<>c%thenondgosub1355,1365
  105. 1280 ife=3andd=1then1270
  106. 1281 gosub5034:return
  107. 1290 ifgl%(0)=a%thenc%=2:a=1:return
  108. 1291 forx=1to8:ifgl%(0)=(a%+sa%(x))thenc%=1:x=8:next:a=1:return
  109. 1292 forx=1to8:ifgl%(0)=(a%-sa%(x))thenc%=1:x=8:next:a=1
  110. 1295 return
  111. 1300 rem    ***** warnings/course change *****
  112. 1305 ms$="[217]ou are entering a storm.":cn=2
  113. 1310 ifd=2thenms$="[217]ou are in a [213]-boat area.":cn=4
  114. 1315 gosub2005:gosub5205:a%=rnd(0)*8+1:ifa%=sd%(0)ord=2thenreturn
  115. 1320 a=1
  116. 1325 a%=rnd(0)*8+1:b%=gl%(0)+sa%(a%)
  117. 1330 ifb%>9andb%<90thengl%(0)=b%:gosub1465:goto1345
  118. 1335 a=a+1:ifa<5then1325
  119. 1340 return
  120. 1345 ms$="[211]torm path causes course change.":gosub5206:sd%(0)=a%:goto1415
  121. 1350 rem    ***** losses *****
  122. 1355 cn=2:gosub2005:rn%=rnd(9)*2+1:ifrn%=2then1358
  123. 1356 ms$="[211]torm damage to "+str$(c%)+" vessel(s).":ifsp%(0)>1thensp%(0)=sp%(0)-1
  124. 1357 ds%(0)=ds%(0)+c%:goto1360
  125. 1358 ms$="[211]torm sinks"+str$(c%)+" vessel(s).":ev%(0)=ev%(0)-c%
  126. 1360 gosub5206:gosub1410:gosub1420:gosub1425
  127. 1361 gosub6020:gosub5034:ife=3then1270
  128. 1362 return
  129. 1365 forf=1toc%:cn=3:gosub2005:nextf
  130. 1366 ms$="[213]boats sink "+str$(c%)+" chaser(s).":ev%(0)=ev%(0)-c%:gosub5206
  131. 1367 gosub1410:gosub6020:goto5034
  132. 1370 rem    ***** hq alert *****
  133. 1375 ms$="[198]8 = [200][209] obstacle reports.":v=18:goto5210
  134. 1380 rem    ***** fuel consumption *****
  135. 1385 mf%=z*(4-ra%(0)):goto1394
  136. 1390 mf%=sp%(0)
  137. 1394 qf=1:fc%(0)=fc%(0)+mf%:fu%(0)=(1000-fc%(0))*100/1000
  138. 1395 iffu%(0)<1thenfu%(0)=0:qf=4
  139. 1396 q=0:a%=0:goto1475
  140. 1400 rem    ***** print status data *****
  141. 1405 a$=str$(we%(1)):v=6:goto1435
  142. 1406 a$=str$(we%(2)):v=7:goto1435
  143. 1410 a$=str$(ev%(0)):v=8:goto1435
  144. 1415 a$=sd$(sd%(0)):v=9:goto1435
  145. 1420 a$=sp$(sp%(0)):v=10:goto1435
  146. 1425 a$=str$(ds%(0)):v=11:goto1435
  147. 1430 a$=str$(us%(0)):v=12
  148. 1435 h=31:ms$="        ":gosub5070:ms$=a$:goto5070
  149. 1440 rem    ***** print status line *****
  150. 1445 gosub5040:forx=1to3:h=dl%(x):ms$=dl$(x):gosub5070:next
  151. 1450 a%=1:q=8
  152. 1455 ona%goto1460,1465,1475
  153. 1460 h=9:e$="   ":a$=str$(se%(0)):goto1480
  154. 1465 h=20:e$="   ":a$=gl$(gl%(0)):goto1480
  155. 1475 h=32:e$="    ":a$=str$(fu%(0)):goto1480
  156. 1480 v=0:ms$=e$:gosub5070:ms$=a$:gosub5070:ifq<>8thenreturn
  157. 1485 a%=a%+1:ifa%<4then1455
  158. 1490 q=0:a%=0:return
  159. 1500 rem    ***** set/unset problem locations *****
  160. 1505 pl%=4-ra%(0):ss=0:ms$="[210]eviewing situation - be patient.":gosub5205
  161. 1510 a%=ra%(0):ot=ot+1:ifot>3thenot=1
  162. 1511 rn%=rnd(0)*48+1
  163. 1512 onotgoto1515,1520,1525
  164. 1515 st%(rn%)=0:l1%(rn%)=0:a%=a%-1:ifa%=0then1530
  165. 1516 goto1511
  166. 1520 ub%(rn%)=0:l2%(rn%)=0:a%=a%-1:ifa%=0then1530
  167. 1521 goto1511
  168. 1525 ds%(0)=ds%(0)-ra%(0):ifds%(0)=<0thends%(0)=0
  169. 1526 gosub1425
  170. 15